import request from '@/utils/request'

// 查询销售订单列表
export function listOrder(query) {
  return request({
    url: '/xiaoshou/order/list',
    method: 'get',
    params: query
  })
}

// 查询销售订单列表
export function listForReciveOrder(query) {
  return request({
    url: '/xiaoshou/order/listForReciveOrder',
    method: 'get',
    params: query
  })
}

// 查询销售订单详细
export function getOrder(Id) {
  return request({
    url: '/xiaoshou/order/' + Id,
    method: 'get'
  })
}

// 根据销售订单编号获取销售订单
export function getSaleOrderListByOrderCodes(code) {
  return request({
    url: '/xiaoshou/order/getSaleOrderListByOrderCodes/' + code,
    method: 'get'
  })
}

//添加销售订单
export function addSaleOrder(Id) {
  return request({
    url: '/xiaoshou/order/addSaleOrder/' + Id,
    method: 'get'
  })
}
export function saleOrderList(orderId) {
  return request({
    url: '/xiaoshou/saleOrderDetail/'+orderId,
    method: 'get',
  })
}
// 新增销售订单
export function addOrder(data) {
  return request({
    url: '/xiaoshou/order',
    method: 'post',
    data: data
  })
}

export function updateSaleOrderStatus(data) {
  return request({
    url: '/xiaoshou/order/updateSaleOrderStatus',
    method: 'post',
    data: data
  })
}
// 修改销售订单
export function updateOrder(data) {
  return request({
    url: '/xiaoshou/order',
    method: 'put',
    data: data
  })
}
export function getAllRequest() {
  return request({
    url: '/xiaoshou/saleRequest/getAllRequest',
    method: 'get',
  })
}
export function saleRequestList(orderId) {
  return request({
    url: '/xiaoshou/saleRequestDetail/'+orderId,
    method: 'get',
  })
}
export function getSaleRequest(id) {
  return request({
    url: '/xiaoshou/saleRequest/' + id,
    method: 'get'
  })
}
// 删除销售订单
export function delOrder(Id) {
  return request({
    url: '/xiaoshou/order/' + Id,
    method: 'delete'
  })
}
